package main

import (
	"github.com/chenhg5/collection"
	"github.com/shopspring/decimal"
	"log"
)

func main() {
	a := []int{12, 4, 5, 6}
	a1 := collection.Collect(a).Each(func(item, value interface{}) (interface{}, bool) {
		return value.(decimal.Decimal).IntPart() + 2, false
	})
	log.Println(collection.Collect(a).Prepend(2).ToIntArray())
	log.Println(a1.ToIntArray())

	b := []map[string]interface{}{
		{"name": "Jack", "sex": 0},
		{"name": "Mary", "sex": 1},
		{"name": "Jane", "sex": 1},
	}
	b1 := collection.Collect(b).Where("name", "Jack").ToMapArray()
	log.Println(b1)
}
